<template>
  <view class="content">
    <view style="background: #fff">
      <basics-list ref="basicsList" @listClick="listClick" />
    </view>
  </view>
</template>
<script>
import basicsList from "@/components/basics-list/basics-list.vue";

export default {
  components: { basicsList },
  data() {
    return {
      roleIds: "",
    };
  },
  onShareAppMessage() {
    return this.$util.returnShareObj();
  },
  onLoad(options) {
    this.roleIds = uni.getStorageSync("roleIds");
    if (this.roleIds) {
      this.$nextTick(() => {
        this.initBasicsList();
      });
    }
  },
  methods: {
    //初始化列表
    initBasicsList() {
      let list = [
        { title: "平台管理员", icon: "yisheng", rightArrow: true, hidden: this.roleIds.indexOf("2") < 0 },
        { title: "医院领导", icon: "yisheng", rightArrow: true, hidden: this.roleIds.indexOf("3") < 0 },
        { title: "医生", icon: "yisheng", rightArrow: true, hidden: this.roleIds.indexOf("4") < 0 },
        { title: "患者", icon: "huanzheguanli", rightArrow: true, hidden: this.roleIds.indexOf("5") < 0 },
      ];
      this.$refs.basicsList.initList(list);
    },
    listClick(index) {
      this.$util.backToRefreshPrevPage("index/index", index + 2);
    },
  },
};
</script>
<style lang="scss" scoped>
.content {
  background: $back-grey-color;
  min-height: 100vh;
}
</style>
